<?php
class Module
{

    public function dbconn( )
    {
        $this->db = new DB();
    }

}

class TableData extends Module
{

    public function __construct( $tbname )
    {
        $this->tbname = $tbname;
    }

    public function Insert( $data )
    {
        $this->dbconn();
        $key = "";
        $str = "";
        foreach ( $data as $field => $value )
        {
            $key = $key.","."`".$field."`";
            $str = $str.","."'".$value."'";
        }
        $key = trim( $key, "," );
        $str = trim( $str, "," );
        $this->db->query( "INSERT IGNORE INTO `".$this->tbname."`(".$key.") VALUES (".$str.");" );
        return True;
    }

}

?>